package com.smart_campus.campus.controller;

import com.smart_campus.campus.domain.CampusCarousel;
import com.smart_campus.campus.service.CampusCarouselService;
import com.smart_campus.campus.vo.CampusCarouselVo;
import com.smart_campus.sys.common.DataGridView;
import com.smart_campus.sys.common.ResultObj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 轮播图
 * @author Alfred
 * @time: 2020/6/23 20:32
 */
@RequestMapping("campus")
@RestController
public class CampusController {


    @Autowired
    private CampusCarouselService carouselService;


    /**
     * 查询列表
     * @param campusCarouselVo
     * @return
     */
    @RequestMapping("queryCarousel")
    public DataGridView queryCarousel(CampusCarouselVo campusCarouselVo){
        return this.carouselService.queryCarousel(campusCarouselVo);
    }



    /**
     * 删除方法
     * @param ids
     * @return
     */
    @RequestMapping("deleteCarousel")
    public ResultObj deleteCarousel(Integer[] ids){
        try {
            for (Integer id : ids) {
                carouselService.deleteByPrimaryKey(id);
            }
            return ResultObj.DELETE_SUCCESS;
        } catch (Exception e) {
            e.printStackTrace();
            return ResultObj.DELETE_ERROR;
        }
    }

}
